local sk__yuanhua = fk.CreateSkill {

  name = "sk__yuanhua",

  tags = { Skill.Compulsory, },

}



sk__yuanhua:addEffect(fk.AfterCardsMove, {
  name = "sk__yuanhua",
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(sk__yuanhua.name) then
      for _, move in ipairs(data) do
        if move.to == player and move.toArea == Card.PlayerHand then
          for _, info in ipairs(move.moveInfo) do
            if Fk:getCardById(info.cardId).trueName == "peach" then
              return true
            end
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if player:isWounded() then
      room:recover({
        who = player,
        num = 1,
        recoverBy = player,
        skillName = sk__yuanhua.name,
      })
    end
    if not player.dead then
      player:drawCards(2, sk__yuanhua.name)
    end
    local cards = {}
    for _, move in ipairs(data) do
      if move.to == player and move.toArea == Card.PlayerHand then
        for _, info in ipairs(move.moveInfo) do
          if Fk:getCardById(info.cardId).trueName == "peach" and table.contains(player:getCardIds("h"), info.cardId) then
            table.insertIfNeed(cards, info.cardId)
          end
        end
      end
    end
    if #cards > 0 then
      room:addPlayerMark(player, sk__yuanhua.name, #cards)
      room:moveCardTo(cards, Card.Void, nil, fk.ReasonJustMove, sk__yuanhua.name, nil, true, player)
    end
  end,
})

return sk__yuanhua